export function renderTime(date) {
    var dateee = new Date(date).toJSON();
    let newDte = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
    var thisTime = newDte;
    thisTime = thisTime.replace(/-/g, '/');
    var time = new Date(thisTime);
    time = time.getTime();
    let timel = new Date(time);
    return timel.getFullYear() + '年' + parseInt(timel.getMonth() + 1) + "月" + timel.getDate() + '日'
    // var dateee = new Date(date).toJSON();
    // return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
}
export function weekDay(date) {
    var dateee = new Date(date).toJSON();
    let newDte = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
    var thisTime = newDte;
    thisTime = thisTime.replace(/-/g, '/');
    var time = new Date(thisTime);
    time = time.getTime();
    let timel = new Date(time);
    var a = new Array("日", "一", "二", "三", "四", "五", "六");
    var week = timel.getDay();
    return "星期" + a[week];
}
export function timeAt(date) {
    var dt = new Date();
    let Minutes = dt.getMinutes();
    let Seconds = dt.getSeconds();
    let month = parseInt(dt.getMonth() + 1);
    let day = dt.getDate();
    if (Seconds < 10) {
        Seconds = "0" + Seconds;
    }
       let timestr= 
        dt.getHours() +
        ":" +
        Minutes +
        ":" +
        Seconds;
        return timestr
}

/**
 * Parse the time to string
 * @param {(Object|string|number)} time
 * @param {string} cFormat
 * @returns {string | null}
 */
 export function parseTime(time, cFormat) {
    if (arguments.length === 0 || !time) {
        return null;
    }
    const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
    let date;
    if (typeof time === "object") {
        date = time;
    } else {
        if (typeof time === "string") {
            if (/^[0-9]+$/.test(time)) {
                // support "1548221490638"
                time = parseInt(time);
            } else {
                time = time.replace(new RegExp(/-/gm), "/");
            }
        }

        if (typeof time === "number" && time.toString().length === 10) {
            time = time * 1000;
        }
        date = new Date(time);
    }
    const formatObj = {
        y: date.getFullYear(),
        m: date.getMonth() + 1,
        d: date.getDate(),
        h: date.getHours(),
        i: date.getMinutes(),
        s: date.getSeconds(),
        a: date.getDay(),
    };
    const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
        const value = formatObj[key];
        if (key === "a") {
            return ["日", "一", "二", "三", "四", "五", "六"][value];
        }
        return value.toString().padStart(2, "0");
    });
    return time_str;
}

// 获得字典中对应的中文名称
export const getLabel = (dictionary, value) => {
    const item = dictionary.filter((e) => e.value == value)[0];

    return item && item.label;
};
export const HighlightLocation = storeId => {
    const storeRoomList = [
      {
        id: 7,
        addName: "上海市",
        name: "上海档案中心(上海青浦)",
        code: "SHQP",
        longitude: "121.140443",
        latitude: "31.232301",
        depotLink: "http://j.map.baidu.com/88/3PlJ",
  
        address: "【上海档案中心】上海市青浦区外青松公路3939号",
      },
      {
        id: 999,
        addName: "南京市",
        name: "窍楚技术档案中心",
        code: "QCJS",
        longitude: "118.809545",
        latitude: "31.97084",
        depotLink: "https://j.map.baidu.com/0c/GhpJ",
  
        address: "【技术档案中心】江苏省南京市江宁区富塘路18号",
      },
      {
        id: 998,
        addName: "南京市",
        name: "窍楚技术档案中心(丰树超平库测试)",
        code: "NJFSAGV",
        longitude: "118.809545",
        latitude: "31.97084",
        depotLink: "https://j.map.baidu.com/0c/GhpJ",
  
        address: "【技术档案中心】江苏省南京市江宁区滨江开发区丰树物流园",
      },
      {
        id: 997,
        addName: "南京市",
        name: "窍楚技术档案中心(方山中行)",
        code: "SAGV",
        longitude: "118.809545",
        latitude: "31.97084",
        depotLink: "https://j.map.baidu.com/0c/GhpJ",
        address: "【技术档案中心】江苏省南京市江宁区城际空间站E1",
      },
      {
        id: 996,
        addName: "南京市",
        name: "窍楚技术档案中心(方山中行)",
        code: "AGV",
        longitude: "118.809545",
        latitude: "31.97084",
        depotLink: "https://j.map.baidu.com/0c/GhpJ",
  
        address: "【技术档案中心】江苏省南京市江宁区城际空间站E1",
      },
      {
        id: 11,
        addName: "上海市",
        name: "上海档案中心(上海邮储)",
        code: "SHYC",
  
        longitude: "121.140443",
        latitude: "31.232301",
        depotLink: "http://j.map.baidu.com/88/3PlJ",
        address: "【上海档案中心】上海市青浦区外青松公路3939号",
      },
      {
        id: 10,
        addName: "徐州市",
        name: "苏北档案中心(徐州中行)",
        code: "XZZHAGV",
        longitude: "117.201199",
        latitude: "34.33465",
        depotLink: "https://j.map.baidu.com/GAa8G",
  
        address:
          "【苏北中央档案中心】徐州市鼓楼区丰树徐州智慧物流园南200米(北三环路北) ",
      },
      {
        id: 9,
        addName: "淮安市",
        name: "苏北档案中心(淮安中移)",
        code: "HAZYAGV",
        longitude: "118.574582",
        latitude: "31.830030",
        depotLink: "https://j.map.baidu.com/cb/Po8c",
  
        address:
          "【苏北档案中心】淮安市开发区承德南路333号移动呼叫基地(支撑楼西塔一楼)",
      },
      {
        id: 8,
        addName: "南京市",
        name: "NJBJ01",
        code: "NJBJ",
        longitude: "118.574582",
        latitude: "31.830030",
        depotLink: "https://j.map.baidu.com/cb/Po8c",
  
        address: "【苏皖档案中心】南京市江宁区景明大街喜燕路丰树南京滨江产业园",
      },
      {
        id: 6,
        addName: "无锡市",
        name: "苏南档案中心(无锡普洛斯)",
        code: "WXPLS",
        longitude: "120.464556",
        latitude: "31.565854",
        depotLink: "https://j.map.baidu.com/17/2Io",
  
        address: "【苏南中央档案中心】无锡市新吴区新韵北路普洛斯梅村物流园A1-U4",
      },
      {
        id: 5,
        addName: "杭州市",
        name: "杭州档案中心(杭州明浦)",
        code: "HZMP",
        longitude: "120.562306",
        latitude: "30.332625",
        depotLink: "https://j.map.baidu.com/b7/VHi",
  
        address: "【杭州档案中心】浙江省杭州市钱塘新区前进街道绿荫路98号C3号库",
      },
      {
        id: 4,
        addName: "无锡市",
        name: "苏南档案中心(无锡红木)",
        code: "WXHM",
        longitude: "120.421844",
        latitude: "31.555862",
        depotLink: "https://j.map.baidu.com/glcG2",
  
        address: "【苏南中央档案中心】无锡市新吴区长江东路2号，红木仓储有限公司",
      },
      {
        id: 3,
        addName: "无锡市",
        name: "苏南档案中心(无锡锡东)",
        code: "WXXD",
        longitude: "120.499254",
        latitude: "31.584693",
        depotLink: "https://j.map.baidu.com/QXY7G",
  
        address: "【苏南中央档案中心】无锡市锡山区联福路601号，锡东科技产业园",
      },
      {
        id: 2,
        addName: "南京市",
        name: "苏中档案中心(南京龙潭)",
        code: "NJLT",
        longitude: "119.084193",
        latitude: "32.215575",
        depotLink: "https://j.map.baidu.com/RwU7G",
  
        address: "【苏中中央档案中心】南京市栖霞区龙潭街道金港路8号",
      },
      {
        id: 1,
        addName: "徐州市",
        name: "苏北档案中心(徐州丰树)",
        code: "XZZH",
  
        longitude: "117.201199",
        latitude: "34.33465",
        depotLink: "https://j.map.baidu.com/GAa8G",
  
        address:
          "【苏北中央档案中心】徐州市鼓楼区丰树徐州智慧物流园南200米(北三环路北) ",
      },
      {
        id: 0,
        addName: "无锡市",
        name: "苏南档案中心(无锡中信)",
        code: "WXZX",
        longitude: "120.387329",
        latitude: "31.606373",
        depotLink: "http://j.map.baidu.com/KG_7G",
        address: "【无锡中信档案中心】无锡市锡山开发区通云南路59号",
      },
      // {
      //   id: -1,
      //   name: "未分配仓库",
      //   code: "YSQ",
      //   longitude: "0",
      //   latitude: "0",
      //   depotLink: null,
  
      //   address: "无",
      // },
    ];
  
    return storeRoomList.filter(m => m.id == storeId)[0].addName
  };